From 1a98d20c192af1ec168648a1a054f2f2bf0e4f49 Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Mon, 5 Jun 2006 01:38:49 +0000 Subject: [PATCH] Fix borderline cases in tab visibility calculation. (#168105, Carlos 2006-06-04 Matthias Clasen * gtk/gtknotebook.c (gtk_notebook_calculate_shown_tabs): (gtk_notebook_calc_tabs): Fix borderline cases in tab visibility calculation. (#168105, Carlos Garnacho Parro) --- ChangeLog | 4 ++++ ChangeLog.pre-2-10 | 4 ++++ gtk/gtknotebook.c | 32 +++++++++++++++++++++++--------- 3 files changed, 31 insertions(+), 9 deletions(-) diff --git a/ChangeLog b/ChangeLog index a2e1455b10..528acb438d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,9 @@ 2006-06-04 Matthias Clasen + * gtk/gtknotebook.c (gtk_notebook_calculate_shown_tabs): + (gtk_notebook_calc_tabs): Fix borderline cases in tab + visibility calculation. (#168105, Carlos Garnacho Parro) + * gdk/x11/gdkfont-x11.c (_gdk_font_destroy): Remove the right XID from the xid table. (#34327, Sampo Savolainen, Tim Janik) diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10 index a2e1455b10..528acb438d 100644 --- a/ChangeLog.pre-2-10 +++ b/ChangeLog.pre-2-10 @@ -1,5 +1,9 @@ 2006-06-04 Matthias Clasen + * gtk/gtknotebook.c (gtk_notebook_calculate_shown_tabs): + (gtk_notebook_calc_tabs): Fix borderline cases in tab + visibility calculation. (#168105, Carlos Garnacho Parro) + * gdk/x11/gdkfont-x11.c (_gdk_font_destroy): Remove the right XID from the xid table. (#34327, Sampo Savolainen, Tim Janik) diff --git a/gtk/gtknotebook.c b/gtk/gtknotebook.c index 12a85bc74b..9f4d7cd283 100644 --- a/gtk/gtknotebook.c +++ b/gtk/gtknotebook.c @@ -4807,7 +4807,7 @@ gtk_notebook_calculate_shown_tabs (GtkNotebook *notebook, &(notebook->focus_tab), remaining_space, STEP_NEXT); } - + if (*remaining_space <= 0) { /* show 1 tab */ @@ -4851,9 +4851,7 @@ gtk_notebook_calculate_shown_tabs (GtkNotebook *notebook, &(notebook->first_tab), remaining_space, STEP_PREV); - page = notebook->focus_tab->data; - if (*remaining_space <= 0 && - !gtk_widget_get_child_visible(page->tab_label)) + if (*remaining_space < 0) { notebook->first_tab = gtk_notebook_search_page (notebook, notebook->first_tab, @@ -5457,8 +5455,10 @@ gtk_notebook_calc_tabs (GtkNotebook *notebook, GtkNotebookPage *page = NULL; GList *children; GList *last_list = NULL; + GList *last_calculated_child = NULL; gboolean pack; gint tab_pos = get_effective_tab_pos (notebook); + guint real_direction; if (!start) return; @@ -5466,7 +5466,9 @@ gtk_notebook_calc_tabs (GtkNotebook *notebook, children = start; pack = GTK_NOTEBOOK_PAGE (start)->pack; if (pack == GTK_PACK_END) - direction = (direction == STEP_PREV) ? STEP_NEXT : STEP_PREV; + real_direction = (direction == STEP_PREV) ? STEP_NEXT : STEP_PREV; + else + real_direction = direction; while (1) { @@ -5489,14 +5491,20 @@ gtk_notebook_calc_tabs (GtkNotebook *notebook, { *tab_space = - (*tab_space + page->requisition.width); + + if (*tab_space == 0 && direction == STEP_PREV) + children = last_calculated_child; + *end = children; } return; } + + last_calculated_child = children; } last_list = children; } - if (direction == STEP_NEXT) + if (real_direction == STEP_NEXT) children = children->next; else children = children->prev; @@ -5519,24 +5527,30 @@ gtk_notebook_calc_tabs (GtkNotebook *notebook, { *tab_space = - (*tab_space + page->requisition.height); + + if (*tab_space == 0 && direction == STEP_PREV) + children = last_calculated_child; + *end = children; } return; } + + last_calculated_child = children; } last_list = children; } - if (direction == STEP_NEXT) + if (real_direction == STEP_NEXT) children = children->next; else children = children->prev; } break; } - if (direction == STEP_PREV) + if (real_direction == STEP_PREV) return; pack = (pack == GTK_PACK_END) ? GTK_PACK_START : GTK_PACK_END; - direction = STEP_PREV; + real_direction = STEP_PREV; children = last_list; } } -- 2.30.2